package com.sand.controller;

import com.sand.dto.Owner.signAddAll;
import com.sand.dto.Owner.signSelect;
import com.sand.result.PageResult;
import com.sand.result.ResponseResult;
import com.sand.service.SignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sign")
public class SignController {

    @Autowired
    private SignService signService;


    /**
     * 客户添加商品标记
     */
    @PostMapping("/addAll")
    private ResponseResult<Integer> addAll(@RequestBody signAddAll addAll ){

        Integer i  = signService.addAll(addAll);

        return new ResponseResult<Integer>().ok(i);
    }

    /**
     * 客户根据标记删除对应的商品
     */
    @PostMapping("/delete")
    private ResponseResult<Integer> delete(@RequestBody String sign){

        Integer i =  signService.delete(sign);

        return new ResponseResult<Integer>().ok(i);
    }


    /**
     * 客户根据标记获取标记的商品
     */
    @PostMapping("/get")
    private ResponseResult<List<signSelect>> select(@RequestBody String sign){

        List<signSelect> list = signService.select(sign);

        return new ResponseResult<List<signSelect>>().ok(list);
    }


}
